Imports System.Xml.Serialization

Namespace Mapping
    Public Class FunctionMappingScalarPropertyCollection
        Inherits Collections.XElementCollection(Of FunctionMappingScalarProperty)

        ''' <summary>Initializes an instance of the <see cref="FunctionMappingScalarPropertyCollection" /> class.</summary>
        ''' <param name="parent">The <see cref="XElement"/> that is the owner of this instance.</param>
        ''' <param name="elementName">The name of the item element.</param>
        Public Sub New(ByVal parent As XElement, ByVal elementName As String)
            MyBase.New(parent, parent.Name.Namespace, elementName)
        End Sub

        ''' <summary>Initializes an instance of the <see cref="FunctionMappingScalarPropertyCollection" /> class.</summary>
        ''' <param name="parent">The <see cref="XElement"/> that is the owner of this instance.</param>
        ''' <param name="elementName">The name of the item element.</param>
        Public Sub New(ByVal parent As XElement, ByVal elementName As XName)
            MyBase.New(parent, elementName)
        End Sub

        ''' <summary>Initializes an instance of the <see cref="FunctionMappingScalarPropertyCollection" /> class.</summary>
        ''' <param name="parent">The <see cref="XElement"/> that is the owner of this instance.</param>
        ''' <param name="namespace">The <see cref="XNamespace"/> of the item element.</param>
        ''' <param name="elementName">The name of the item element.</param>
        Public Sub New(ByVal parent As XElement, ByVal [namespace] As XNamespace, ByVal elementName As String)
            MyBase.New(parent, [namespace], elementName)
        End Sub

        Public Overrides Sub Add(ByVal item As FunctionMappingScalarProperty)
            If (MyBase.Parent.FirstNode Is Nothing) Then
                MyBase.Add(item)
            Else
                MyBase.Parent.FirstNode.AddBeforeSelf(item)
            End If
        End Sub

    End Class

End Namespace
